package com.sinosoft.vaccinetoai.server.business.chatchainrecord.deletechatchainrecord.service.impl;

import com.sinosoft.vaccinetoai.dao.mapper.business.ChatChainRecordMapper;
import com.sinosoft.vaccinetoai.dao.mapper.business.ChatRecordMapper;
import com.sinosoft.vaccinetoai.server.business.chatchainrecord.deletechatchainrecord.vo.DeleteChatChainRecordVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import com.sinosoft.vaccinetoai.server.business.chatchainrecord.deletechatchainrecord.io.DeleteChatChainRecordIO;

import com.sinosoft.vaccinetoai.server.business.chatchainrecord.deletechatchainrecord.service.IDeleteChatChainRecordService;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @ClassName: DeleteChatChainRecordServiceImpl
 * @ClassNameExplain: 
 * @Description: 删除聊天链历史列表Service Impl
 * @author xiazhihao
 * @date 2023年12月20日 19:38
 */
@Slf4j
@Service("DeleteChatChainRecordService")
public class DeleteChatChainRecordServiceImpl implements IDeleteChatChainRecordService {

	@Resource
	private ChatChainRecordMapper chatChainRecordMapper;

	@Resource
	private ChatRecordMapper chatRecordMapper;

	@Override
	@Transactional
	public DeleteChatChainRecordVO deleteChatChainRecord(DeleteChatChainRecordIO io) throws Exception {
        DeleteChatChainRecordVO vo = new DeleteChatChainRecordVO();
        chatChainRecordMapper.batchDelete(io.getIds());
        //继续删除聊天链下的聊天记录
		chatRecordMapper.batchDeleteByChainId(io.getIds());
		return vo;
	}
	
}